package customerEnter.Frame.JDBCDaoEnhance.daoFrame;

import java.util.List;

import org.springframework.stereotype.Service;

import customerEnter.Frame.JDBCDao.Interface.ParametersResultInterface;
import customerEnter.Frame.JDBCDao.daoFrame.SqlDataBaseController;
import customerEnter.Frame.JDBCDaoEnhance.Interface.DaoFrameDMLBaseEnhanceInterfaces;

@SuppressWarnings({ "rawtypes", "hiding" })
@Service("dMLParameterSettingEnhanceImpl")
public class DMLParameterSettingEnhanceImpl<T, K> extends DaoFrameDMLTransEnhanceImpl<T, K> implements
		DaoFrameDMLBaseEnhanceInterfaces {

	public DMLParameterSettingEnhanceImpl() {

	}

	@Override
	public <T> List<T> findAll(String tableName, Class<T> class1) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryList(null, tableName, null, class1,
				false, false));
	}

	@Override
	public <T> T findId(Integer id, String tableName, Class<T> class1) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryBean(null, tableName, " where id="
				+ id, class1, false));
	}

	@Override
	public <T> List<T> findSeleList(String Front, String ClassName, String where, Class<T> class1) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryList(Front, ClassName,
				SqlDataBaseController.getWhere() + where, class1, false, false));
	}

	@Override
	public <T> List<T> findSelecJoinOnTable(String Front, String ClassName, String where, Class<T> Class) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryList(Front, ClassName, where, Class,
				false, false));
	}

	@Override
	public <T> List<T> findSelectOneOrMay(String Front, String ClassName, String where, Class<T> Class) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryOneOrMayList(Front, ClassName,
				SqlDataBaseController.getWhere() + where, Class, false, false));
	}

	@Override
	public <T> T findCountData(String Front, String ClassName, String where) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryInteger(Front, ClassName,
				SqlDataBaseController.getWhere() + where));
	}

	@Override
	public <T> List<T> findPagingTransmissionData(String Front, String ClassName, String where, int size, int page,
			String order, String descOrAsc, Class<T> Class) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryPage(Front, ClassName,
				SqlDataBaseController.getWhere() + where, Class, false, false, size, page, order, descOrAsc));
	}

	@Override
	public <T> List<T> findPagingTransmissionData(String Front, String ClassName, String where, int size, int page,
			String order, String descOrAsc, int position, Class<T> Class) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryPageTime(Front, ClassName,
				SqlDataBaseController.getWhere() + where, Class, false, false, size, page, order, descOrAsc, position));
	}

	@Override
	public ParametersResultInterface findPagingParametersResultData(String Front, String ClassName, String where,
			int size, int page, String order, String descOrAsc, Class<?> Class) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryPage(Front, ClassName,
				SqlDataBaseController.getWhere() + where, Class, true, false, size, page, order, descOrAsc));
	}

	@Override
	public <T> T querySingleMap(String Front, String ClassName, String where) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryMap(Front, ClassName,
				SqlDataBaseController.getWhere() + where, false));
	}

	@Override
	public <T> T querySingleListMap(String Front, String ClassName, String where) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryListMap(Front, ClassName,
				SqlDataBaseController.getWhere() + where, false));
	}

	@Override
	public <T> List<T> querySingleListPageMap(String Front, String ClassName, String where, int size, int page,
			String order, String descOrAsc, int position) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryListPageMap(Front, ClassName,
				SqlDataBaseController.getWhere() + where, null, false, false, size, page, order, descOrAsc, position));
	}

	@Override
	public <T> T querySingleListObjects(String Front, String ClassName, String where) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryListObjects(Front, ClassName,
				SqlDataBaseController.getWhere() + where, false));
	}

	@Override
	public <T> T querySingleString(String Front, String ClassName, String where) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryString(Front, ClassName,
				SqlDataBaseController.getWhere() + where, false));
	}

	@Override
	public <T> T querySingleDate(String Front, String ClassName, String where, Class<T> Class) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.findQueryBean(Front, ClassName,
				SqlDataBaseController.getWhere() + where, Class, false));
	}

	@Override
	public <T> T saveTable(String Table, Object MappingObject) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.InsterObject(Table, MappingObject));
	}

	@Override
	public <T> T saveTableReturnId(String Table, Object MappingObject) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.InsterObject(Table, MappingObject, true));
	}

	@Override
	public <T> T UpdateTable(String TableName, Object MappingObject, String where) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.updateTable(TableName, MappingObject, where));
	}

	@Override
	public <T> Object InsertBatch(String TableName, List<T> t, Class<T> class1) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.InsertBatch(TableName, t, class1));
	}

	@Override
	public Integer deleteObject(String TableName, int id) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.delete(TableName,
				SqlDataBaseController.getWhere() + " and id=" + id));
	}

	@Override
	public Integer deleteObject(String TableName, String where) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.delete(TableName,
				SqlDataBaseController.getWhere() + where));
	}

	@Override
	public <T> T savePreparedStatementReturnId(String Table, Object[] objects) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.savePreparedStatementReturnId(Table, objects));
	}

	@Override
	public <T> T savePreparedStatementBatch(String Table, List<Object[]> objects) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.savePreparedStatementBatch(Table, objects));
	}

	@Override
	public <T> T UpdatePreparedStatement(String TableName, String where, Object[] objects) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.UpdatePreparedStatement(TableName, where,
				objects));
	}

	@Override
	public <T> T UpdatePreparedStatementBatch(String TableName, String where, List<Object[]> objects) {
		// TODO Auto-generated method stub
		return ExecuteConditionResultObject(dmlParameterSettingInterface.UpdatePreparedStatementBatch(TableName, where,
				objects));
	}

}
